<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class AddFieldsToActivityPrizesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::table('activity_prizes', function (Blueprint $table) {
            $table->string('type')->default(\App\Models\ActivityPrize::TYPE_NORMAL)->comment('奖品类型');
            $table->string('valid_at')->nullable()->comment('生效时间');
            $table->string('due_at')->nullable()->comment('失效时间');
            $table->string('limit',20)->default(\App\Models\ActivityPrize::LIMIT_TOTAL)->comment('限制类型');
            $table->integer('limit_value')->nullable()->comment('限制数');
            $table->string('remark')->nullable()->comment('备注');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::table('activity_prizes', function (Blueprint $table) {
            $table->dropColumn('type');
            $table->dropColumn('coupon_title');
            $table->dropColumn('soc_code');
            $table->dropColumn('soc_price');
            $table->dropColumn('valid_at');
            $table->dropColumn('due_at');
            $table->dropColumn('limit');
            $table->dropColumn('limit_value');
            $table->dropColumn('remark');
        });
    }
}
